package week2nd;

import java.util.Scanner;
import java.util.StringTokenizer;

public class PP3_2 {

    public static void main(String[] args) {
        String result = "";
        System.out.println("输入需要转换的句子:");
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();
        StringTokenizer st = new StringTokenizer(string, " ");
        System.out.print("结果为:");
        while (st.hasMoreElements()) {
            result += updown(st.nextToken()) + " ";
        }
        System.out.println(result);
    }

    public static String updown(String str) {
        ArrayStack as = new ArrayStack(10);
        String string = "";
        char a[] = str.toCharArray();
        for (int i = 0; i < a.length; i++) {
            as.push(a[i]);
        }
        while (!as.isEmpty()) {
            string += as.pop();
        }
        return string;
    }
}
